<template>
  <div>
    <el-dialog
        :visible.sync="addOrderShow1"
        width="60%"
    >
      <!--      <FindById :movie-id="findByPurchaseRecordBeanIdId" v-if="findByPurchaseRecordBeanIdShow2"-->
      <!--                ref="findByPurchaseRecordBeanIdRef"></FindById>-->
<!--      <AddOrder :movie-id="addOrderId" v-if="addOrderShow2" ref="addOrderRef"></AddOrder>-->
      <Estest :movie-id="addOrderId" v-if="addOrderShow2" ref="addOrderRef"></Estest>
    </el-dialog>
    <h1>论坛</h1>
    <template>
      <el-table
          :data="mid"
          stripe
          style="width: 100%">
        <el-table-column
            prop="title"
            label="标题"
            align="center">
        </el-table-column>
        <el-table-column
            prop="time"
            label="日期"
            align="center">
        </el-table-column>
        <el-table-column
            prop="type"
            label="类型"
            align="center">
        </el-table-column>
        <el-table-column
            prop=""
            label="操作"
            align="center">
          <template slot-scope="scope">
            <el-button plain
                       slot="reference"
                       type="primary" @click="handleChange(scope.row)">
              看帖
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </template>

    <el-col :span="5" style="margin-top: 10px">
      <el-input v-model="i1" placeholder="请输入类型"></el-input>
      <el-button plain style="margin-top: 10px" @click="input1">类型查询</el-button>
    </el-col>

    <el-col :span="5" style="margin-top: 10px;margin-left: 50px">
      <el-input v-model="i2" placeholder="请输入内容"></el-input>
      <el-button plain style="margin-top: 10px" @click="input2">全文搜索</el-button>
    </el-col>
  </div>
</template>

<script>
import Estest from "./estest";
export default {
  name: "order",
  components: {Estest},
  data() {
    return {
      mid: '',
      i1: '',
      i2: '',

      addOrderShow1: false,
      addOrderShow2: false,
      addOrderId: 0,
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    handleChange(val){
      console.log(val)
      this.addOrderShow1=true
      this.addOrderShow2=true
      this.$nextTick(() => {
        this.$refs.addOrderRef.init(val)
      })
    },
    init() {
      this.$axios.get("meituan/meituan/esTestOne").then(
          r => {
            console.log(r.data)
            this.mid = r.data;
          }
      )
    },
    input1() {
      this.$axios.get("meituan/meituan/esTestThere/" + this.i1).then(
          r => {
            this.mid = r.data
          }
      )
    },
    input2() {
      this.$axios.get("meituan/meituan/esTestTwo/" + this.i2).then(
          r => {
            this.mid = r.data
          }
      )
    }
  }
}
</script>

<style scoped>

</style>